<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" type="text/css" href="../css/aui.2.0.css" />
   
</head>

<body>
    <header id='header' class="aui-bar aui-bar-nav" style="background-color: #03a9f4">
        <a class="aui-pull-left aui-btn" onclick="api.closeWin();">
            <span class="aui-iconfont aui-icon-left"></span>
        </a>
        <div class="aui-title" id="middle">
            扫码绑定
        </div>
    </header>
    
    <div style="width:100%;margin-top:2%;"></div>
    <div style="background-color:white; height: 100%;width: 100%;margin-top:2%;margin-bottom:50px;">
        <table class="table" style='width:100%;' id="table">  <thead>
                <tr style="text-align: center;background-color: #DCE9F2;color: #467aa7;font-size: 15px;font-weight: bold;">
                    
                    
                    <td algin='center' >物料号</td>
                    <td algin='center'  >物料名</td>
                    <td algin='center' >箱号</td>
                    <td algin='center'  >包装数量</td>
                </tr>
            </thead>
        
            <tbody id="tbodyHtml" >
            </tbody>
        </table>

    </div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="../script/public.js"></script>
<script>
    //光标所在id
    var idSelector = "";
    var workCenterGid = ""; //仓库GID
    var workCenterCode = ""; //仓库编码
    var workCenterName = ""; //仓库名称
    var workCellGid = ""; //库位GID
    var workCellCode = ""; //库位编码
    var workCellName = ""; //库位名称

    var lotCode = "";
    var qty = "";
    var boxnum = "";
    var tmId = "";
   

    apiready = function() {
        
        getDetailList();
    }

    // 获取光标所在组件的id
    function getIdSelector() {
        var e = event || window.event;
        var el = e.srcElement || e.target;
        idSelector = el.id;
        $("#" + el.id).select();
    }

    function getDetailList() {
        var tray=api.pageParam.tray;

        var un = localStorage.getItem('un');
        var serverUrl = localStorage.getItem('serverUrl');
        var url = serverUrl + "/app/getMrlBoxnum";
        var data = {
            values: { ////以表单方式提交参数（JSON对象）
                tray: tray,
                un: un
            }
        };
        api.ajax({
            url: url,
            method: 'post',
            dataType: 'json',
            timeout: 300,
            returnAll: false,
            data: data
        }, function(ret, err) {
            if (ret) {
                var data = JSON.stringify(ret);
                var myobj = eval("(" + data + ")");
                if (myobj.code == '0') {
                    var list = myobj.list;
                    var html = "";
                    var actualQty = 0;
                    for (var i = 0; i < list.length; i++) {
                        html += "<tr style='text-align: center;background-color: #F5F5F5;color: black;font-size: 11px;'>";
                        
                        //html += "<tr style='text-align: center; height: 100%;background-color: #F5F5F5;width: 100%;color: black;font-size: 12px;'>";
                        //html += "<td style='width:30px;'><input name='sub' type='checkbox' /></td>";
                        html += "<td name='mrlCode' >" + list[i].mrlCode + "</td>";
                        html += "<td name='mrlName'>" + list[i].mrlName + "</td>";
                        html += "<td name='boxnum'>" + list[i].boxnum + "</td>";
                                            
                        html += "<td name='qty'>" + list[i].qty + "</td>";                      
                        html += "</tr>";
                    }
                    $api.html($api.byId("tbodyHtml"), html);
                    //失败
                } else {
                    //清空表格数据
                    $api.html($api.byId("tbodyHtml"), "");
                    api.toast({
                        msg: myobj.message,
                        duration: 3000
                    });
                }
            }
        });
    }

    //返回按钮
    function closeWin() {
        api.closeWin({});

        api.execScript({
            name: "uwmSFKScanCodeBinding",
        });
    }
</script>

</html>
